import React, { Component} from 'react'
import { Switch, Route, withRouter} from 'react-router-dom'
import loadable from "react-loadable"
const loading = ({isLoading, error}) => {
    if (isLoading) {
        return <div>Loading...</div>;
    } else if (error) {
        return <div>Sorry, there was a problem loading the page.</div>;
    } else {
        return null;
    }
};
//客户管理
const DataCount = loadable({loader: () => import('@/pages/dataCount'), loading: loading});
class RightContent extends Component { 
    renderRouter(route) { 
        const componentList = {
            '/': <DataCount />,
            "/admin/dataCount":<DataCount/>
        }
        return componentList[route];
    }
    render() { 
        return (
            <div id="rightContent">
                <Switch>
                    <Route exact path='/' component={() => this.renderRouter('/admin/dataCount')} />
                    <Route exact path='/admin/dataCount' component={() => this.renderRouter('/admin/dataCount')}/>
              </Switch>
            </div>
        )
    }
}
export default withRouter(RightContent);